package com.deepexi.sample.service.impl;

import com.deepexi.sample.entity.Tree;
import com.deepexi.sample.entity.TreeExample;
import com.deepexi.sample.mapper.TreeMapper;
import com.deepexi.sample.service.TreeService;
import com.deepexi.sample.vo.TreeVo;
import lombok.extern.slf4j.Slf4j;
import org.dozer.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@Service
public class TreeServiceImpl implements TreeService {

    @Autowired
    protected Mapper dozerMapper;

    @SuppressWarnings("all")
    @Autowired
    private TreeMapper treeMapper;

    @Override
    public List<TreeVo> GetTree() {
        List<Tree> list = treeMapper.selectByExample(new TreeExample());
        List<TreeVo> listVo = new ArrayList<>();
        dozerMapper.map(list, listVo);
        return listVo;
    }
}
